<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head>
	<meta charset="UTF-8">
    <title>机器人运行数据采集</title>
    <%@ include file="head.jsp" %>
</head>
<body>
<blockquote class="layui-elem-quote" style="margin-top: 20px;margin-left: 10px;">机器人日志记录</blockquote>
<div class="layui-col-md12" style="height: 450px;">

        <div  style="width: 70%; height: 400px; margin: 0 auto;
            position: relative; top: 50%; transform: translateY(-50%);">

            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">机器人ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="car_id" required  lay-verify="number" placeholder="请输设备ID" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">机器人充电日期</label>
                    <div class="layui-inline">
			   
					      <input id="date_save_ele" class="layui-input" name="date_save_ele" placeholder="请选择日期" />
					</div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">充电开始时间</label>
                    <div class="layui-inline">
			   
					      <input id="date_begin" class="layui-input" name="date_begin" placeholder="请选择日期时间" />
					</div>
                    <!-- <div class="layui-input-block">
                        <input type="text" name="time" required   placeholder="请输入时间" autocomplete="off" class="layui-input">
                    </div> -->
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">充电结束时间</label>
                    <div class="layui-inline">
			   
					      <input id="date_end" class="layui-input" name="date_end" placeholder="请选择日期时间" />
					</div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-sm" lay-submit lay-filter="formDemo">确定</button>
                        <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
                    </div>
                </div>
                
            </form>
        </div>
    </div>



<script>
    //Demo
    layui.use(['form','laydate'], function(){
    	 var form = layui.form;
         var $ = layui.$;
         var element = layui.element;
         var layer = layui.layer;

         var laydate = layui.laydate;
         
         
         
         /* 显示当前时间函数  */
         function show(){
         	   var mydate = new Date();
         	   
         	   var str = "" + mydate.getFullYear() + "-";
         	   str += (mydate.getMonth()+1) + "-";
         	   str += mydate.getDate() ;
         	   return str;
         }
         
         /* 日期选择的初始化 */
        laydate.render({
 		    elem: '#date_begin'
 		    ,type:'datetime'
 		    ,max: show()
 		    ,btns: ['clear','now', 'confirm']
 		});
        
        /* 日期选择的初始化 */
       laydate.render({
		    elem: '#date_end'
		    ,type:'datetime'
		    ,max: show()
		    ,btns: ['clear','now', 'confirm']
		});
       
       /* 日期选择的初始化 */
      laydate.render({
		    elem: '#date_save_ele'
		    ,type:'date'
		    ,max: show()
		    ,btns: ['clear','now', 'confirm']
		});
        form.on('submit(formDemo)', function(data,index){
            var data1 = JSON.stringify(data.field);
			
            $.post("addCar_run","data="+data1,function(msg){

				if(msg == "success"){
					layer.msg("上传日志成功！");
					$("form")[0].reset() ;
					//parent.location.reload();
				}
            });
			
            layer.close(index);
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index);

            
            return false;
        });
    });
</script>



</body>
</html>